function SwitchTextToEdit(target)
{
	var editValue = document.getElementById("a-"+target).innerHTML;
	var fieldName = document.getElementById("v-"+target).value;
	
	
	var htmlTextBox = '<table><tr><td>'+
					'<input type="text" value="'+editValue+'" name="text-'+target+'" id="text-'+target+'" width="40"/></td><td>'+
					  '<img src="./images/menu/save_16x16.png" alt="'+varLangSave+'" onclick="SaveEditText(\''+fieldName+'\', \''+target+'\');" />'+
					  '</td></tr></table>';
	
	document.getElementById("div-"+target).innerHTML = htmlTextBox;
}
function SaveEditText(fieldName, target)
{
	var site = document.getElementById("dgv-site").value;
	var row = target.split("-")[0] - 1;
	var id = document.getElementById("cb"+row).value;
	var value = document.getElementById("text-"+target).value;
	
	var loadPage = "fastEdit.php?s="+site+"&value="+value+"&field="+fieldName+"&id="+id+"&target="+target;
	
	LoadWithJava(loadPage, "div-"+target);
}

function SwitchToComboBoxEdit(array, target)
{
	var split = array.split(";");
	var currentID = document.getElementById("id-"+target).value;
	var html = '<select name="select-'+target+'" id="select-'+target+'" onChange="SaveComboBoxValue(\''+target+'\');">';
	
	for(var i = 0; i < split.length; ++i)
	{
		if(split[i] == "")
			continue;
		
		var split2 = split[i].split(",");
		
		if(split2[0] == currentID)
		{
			html += '<option value="'+split2[0]+'" selected>'+split2[1]+'</option>';
		}
		else
		{
			html += '<option value="'+split2[0]+'">'+split2[1]+'</option>';
		}
	}
	html += "</select>";
	document.getElementById("div-"+target).innerHTML = html;
}

function SaveComboBoxValue(target)
{
	var fieldName = document.getElementById("v-"+target).value;
	var site = document.getElementById("dgv-site").value;
	var value = document.getElementById("select-"+target).value;
	var row = target.split("-")[0] - 1;
	var id = document.getElementById("cb"+row).value;
	
	var loadPage = "fastEdit.php?s="+site+"&action=combobox&value="+value+"&field="+fieldName+"&id="+id+"&target="+target;
	
	Load(loadPage, "div-"+target);
	document.getElementById("id-"+target).value = value;
}